<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>add</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/style/css/amazeui.min.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/style/css/app.css">
<link
	href="${pageContext.request.contextPath}/style/css/bootstrap.min.css"
	rel="stylesheet">
<link
	href="${pageContext.request.contextPath}/style/layui/css/layui.css"
	rel="stylesheet">
<script src="${pageContext.request.contextPath}/style/js/jquery.min.js"></script>
<script
	src="${pageContext.request.contextPath}/style/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/style/js/amazeui.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/style/layui/layui.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/style/js/data.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/style/js/province.js"></script>

</head>

<body>
	<form id="form" class="layui-form" action="#">
		<br>
		<div class="layui-form-item">
			<label class="layui-form-label">茶名</label>
			<div class="layui-input-block">
				<input type="text" name="pickTeaname" style="width:300px" required
					lay-verify="required" placeholder="请输入茶名" autocomplete="off"
					class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">采摘方式</label>
			<div class="layui-input-block" style="width:300px">
				<select name="pickOperate" lay-verify="required">
					<c:forEach items="${codelist }" var="list">
						<option value="${list.codeValue }">${list.codeName }</option>
					</c:forEach>

				</select>
			</div>
			
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">茶园</label>
			<div class="layui-input-block" style="width:300px">
				<select name="pickLandid" lay-verify="required">
					<c:forEach items="${land }" var="l">
						<option value="${l.landId }">${l.landName }</option>
					</c:forEach>

				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">重量</label>
			<div class="layui-inline" style="left:30px;width:250px">
				<input type="text" name="pickQuality" style="width:200px" required
					lay-verify="required|number" placeholder="请输入重量" autocomplete="off"
					class="layui-input">
			</div>
			<div class="layui-inline" style="left:-15px;width:5%">
				<label>克</label>

			</div>
		</div>
		 
	 
		<br>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button lay-submit class="btn btn-primary"
					lay-filter="go" id="sub">确定</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>

	</form>
</body>
<script type="text/javascript">
	layui.use('form', function() {
		var form = layui.form;
		form.on('submit(go)', function(data) {
			addproc();
			return false;
		});
	});
</script>
<script type="text/javascript">
	function addproc(){$.ajax({
		type : "POST",
		url : "${pageContext.request.contextPath}/pick/addproc",
		data : $("#form").serialize(),
		dataType : "text",
		success : function(res) {
			  if (res == "success") {
				layui.use('layer', function() {
					var layer = layui.layer;
					var index = parent.layer.getFrameIndex(window.name);
					layer.alert('采摘入库成功', {
						skin : 'layui-layer-molv' //样式类名
						,
						closeBtn : 0
					}, function() {
						parent.layer.close(index);
					});
				});
			} else {
				alert("采摘入库失败");
			}
		},
		error : function() {
			alert("error");
		}

	});}
</script>
</html>
